package com.xiaoxing.salesclient.mvp.ui.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xiaoxing.salesclient.mvp.model.entity.ProductList;

import java.util.List;

import xiaoxing.com.salesclient.R;


public class JiFenShangChengTabAdapter extends BaseQuickAdapter<ProductList.DataBean, BaseViewHolder> {

    private Context mContext;
    private OrderExchange mOrderExchange;

    public JiFenShangChengTabAdapter(Context context, @Nullable List<ProductList.DataBean> data, OrderExchange orderExchange) {
        super(R.layout.item_ji_fen_shang_cheng_tab, data);
        this.mContext = context;
        this.mOrderExchange = orderExchange;
    }

    @Override
    protected void convert(BaseViewHolder helper, ProductList.DataBean item) {

        helper.setText(R.id.tv_name, item.getProduct_name());
        helper.setText(R.id.tv_score, item.getExchange_points());


        helper.setOnClickListener(R.id.tv_dui_huan, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mOrderExchange.orderExchange(item.getProduct_id());
            }
        });
    }

    public interface OrderExchange {
        void orderExchange(String product_id);
    }


}
